home *** CD-ROM | disk | FTP | other *** search
/ Freelog 22 / freelog 22.iso / Prog / Djgpp / GPC2952B.ZIP / doc / gpc / docdemos / nulldemo.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-02-09  |  735 b   |  33 lines

  1. program NullDemo;
  2. type
  3.   PString = ^String;
  4. var
  5.   Com1: String (25) = 'This is an amazing number';
  6.   Com2: String (25) = 'This is a boring number';
  7.  
  8. procedure FooBar (Foo: Integer; var Comment: PString);
  9. begin
  10.   if Odd (Foo) then
  11.     WriteLn ('FooBar:', Foo, ' is odd')
  12.    else
  13.     WriteLn ('FooBar:', Foo, ' is even');
  14.   if @Comment <> nil then
  15.     if not Odd(foo) then
  16.       Comment := @Com1
  17.     else
  18.       Comment := @Com2
  19. end;
  20.  
  21. var
  22.   S: String (25);
  23.   P: PString value @S;
  24.  
  25. begin
  26.   { FooBar allows you to leave out variables
  27.     for any information you might not need }
  28.   FooBar (1, Null);
  29.   { But FooBar is flexible, after all }
  30.   FooBar (6, p);
  31.   WriteLn ('FooBar said about 6: `', P^, '''')
  32. end.
  33.